package androidx.blogger;

import android.app.Application;
import androidx.gdata.blogger.Blog;
import androidx.gdata.blogger.BlogCollection;
import androidx.gdata.blogger.BlogEntry;
import androidx.gdata.blogger.BlogEntryCollection;
import androidx.gdata.blogger.BloggerServer;
import androidx.gdata.blogger.BloggerServerFactory;

public class BloggerApplication extends Application {
  public static final String ABLOGGER_APPLICATION_URI = "market://search?q=pname:androidx.blogger";
	private static BloggerApplication singleton;
  private String auth;
  private String username;
  private BloggerServer server;
  private BlogCollection blogs;
  private Blog currentBlog;
  private BlogEntry currentPost;
  private BlogEntryCollection blogsEntries;
  
  @Override
  public final void onCreate() {
    super.onCreate();
    singleton = this;
  }
  
  public void reset() {
    auth = null;
    username = null;
    server = null;
    blogs = null;
    currentBlog = null;
    currentPost = null;
    blogsEntries = null;
  }
  
  public static BloggerApplication getInstance() {
    return singleton;
  }
  
  public String getAuth() {
    return auth;
  }
  
  public void setAuth(String username, String auth) {
    this.username = username;
    this.auth = auth;
    server = BloggerServerFactory.getServer(username, auth);
  }
  
  public BloggerServer getServer() {
  	return server;
  }
  
  public String getUsername() {
    return username;
  }
  
  public BlogEntryCollection getBlogEntryCollection() {
    return blogsEntries;
  }
  
  public void setBlogEntryCollection(BlogEntryCollection _blogEntries) {
    blogsEntries = _blogEntries;
  }
  
  public BlogCollection getBlogCollection() {
    return blogs;
  }
  
  public void setBlogCollection(BlogCollection _blogs) {
    blogs = _blogs;
  }
  
  public void setCurrentBlog(Blog blog) {
  	currentBlog = blog;
  }
  
  public Blog getCurrentBlog() {
  	return currentBlog;
  }
  
  public void setCurrentPost(BlogEntry post) {
  	this.currentPost = post;
  }
  
  public BlogEntry getCurrentPost() {
  	return currentPost;
  }
  
}
